package com.small.nacos.naming.core;

import com.small.nacos.naming.healthcheck.ClientBeatCheckTask;
import com.small.nacos.naming.healthcheck.HealthCheckReactor;

/**
 * @Author zhoujin
 * @Date 2022/7/23 11:32
 */
public class Service extends com.alibaba.nacos.api.naming.pojo.Service{

    private String namespaceId;

    private volatile long lastModifiedMillis = 0L;

    private ClientBeatCheckTask clientBeatCheckTask = new ClientBeatCheckTask(this);

    public void init(){
        HealthCheckReactor.scheduleCheck(clientBeatCheckTask);
    }

    public void destroy() throws Exception {
        HealthCheckReactor.cancelCheck(clientBeatCheckTask);
    }

    public String getNamespaceId() {
        return namespaceId;
    }

    public void setNamespaceId(String namespaceId) {
        this.namespaceId = namespaceId;
    }

    public long getLastModifiedMillis() {
        return lastModifiedMillis;
    }

    public void setLastModifiedMillis(long lastModifiedMillis) {
        this.lastModifiedMillis = lastModifiedMillis;
    }
}
